package com.yc.snacknet_vue.dao.impl;

import java.util.List;

import com.yc.snacknet_vue.bean.AddrInfo;
import com.yc.snacknet_vue.dao.DBHelper;
import com.yc.snacknet_vue.dao.IAddrInfoDAO;

public class AddrInfoDAOImpl implements IAddrInfoDAO{

	@Override
	public int add(AddrInfo addr) {
		DBHelper db = new DBHelper();
		String sql = "insert into addrinfo values( ?, ?, ?, ?, ?, ?, ?, ?, 0, 1)";
		return db.update(sql, addr.getAno(), addr.getMno(), addr.getName(), addr.getTel(),
						addr.getProvince(), addr.getCity(), addr.getArea(), addr.getAddr());
	}

	@Override
	public List<AddrInfo> findByMno(Integer mno) {
		DBHelper db = new DBHelper();
		String sql = "select ano, mno, name , tel, province, city, area, addr, flag from addrinfo where  status != 0 and mno = ?";
		return db.findMultiple(AddrInfo.class, sql, mno);
	}

}
